package com.bone.common.constant;

/**
 * @author : 王可可
 * @date : 2020/12/6 21:55
 * Description : 常量字典
 */
public class Dict {

    public static final Integer USER_STATUS_OK = 1;

    public static final Integer USER_STATUS_NO = 0;

    /**
     * 存放Token的请求头名称
     **/
    public final static String X_ACCESS_TOKEN = "Authentication";

    public static final String USER_TOKEN_ID = "userId";

    public static final String UMS_SHIRO_REDIS_SIGN = "id";

    public static final String UMS_SHIRO_REDIS_HOST = "127.0.0.1";

    public static final Integer UMS_SHIRO_REDIS_PROT = 6379;

    public static final Integer UMS_SHIRO_REDIS_TIMEOUT = 0;

    public final static String SET_KEY_DEFAULT = "";
    public final static String INFO_FROM_TOKEN_DEFAULT = "username";

    /**
     * 缓存key前缀  refresh_token
     **/
    public static final String PREFIX_SHIRO_REFRESH_TOKEN = "shiro:refresh_token:";

    /**
     * 缓存key前缀  shiro权限 permission
     **/
    public static final String PREFIX_SHIRO_PERMISSIONS = "shiro:permissions:";

    /**
     * redis管理权限key
     **/
    public static final String SHIRO_REDIS_ROLE_PERMISSION = "roleAndPermission";

    public static final String SHIRO_TOKEN_AUTHENTICATION = "tokenAuthentication";

    /**
     * redis管理权限前缀
     **/
    public static final String PREFIX_SHIRO = "shiro:cache:";

    /**
     * 权限生命周期  2h
     **/
    public static final Integer ROLES_PERMISSIONS_LIVE_TIME = 7200;

    /**
     * 缓存key前缀  shiro角色 role
     **/
    public static final String PREFIX_SHIRO_ROLES = "shiro:roles:";

    /**
     * refresh_token 过期时间 一天
     */
    public static final Integer REFRESH_TOKEN_TIME = 24 * 3600;

    /**
     * 时间戳 字符串 用于比对token和refresh_token
     */
    public static final String CURRENT_TIME_MILLIS = "currentTimeMillis";

    /**
     * 缓存用户前缀
     **/
    public static final String PREFIX_USER = "user:";

    /**
     * 缓存用户名存在的信息 （生命周期1h）
     **/
    public static final Integer USER_LIVE_TIME = 60 * 60;

    /**
     * 缓存用户名不存在的信息  防止缓存穿透 （生命周期5min）
     **/
    public static final Integer USER_NULL_LIVE_TIME = 5 * 60;

}
